package mq.demo.ack;

import cn.itlaobing.Util.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

/**
 * @author mifei
 * @create 2018年04月12日
 **/
public class Send {
    private final static String QUEUE_NAME = "mf_test_work";

    public static void main(String[] argv) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();

        // 声明队列
        channel.queueDeclare(QUEUE_NAME, false, false, false, null);

        for (int i = 0; i < 50; i++) {
            String message = "" + i;
            channel.basicPublish("", QUEUE_NAME, null, message.getBytes());

            //Thread.sleep(i * 10);
        }

        channel.close();
        connection.close();
    }
}
